import request from '@/utils/request';

// 待审批
export function pendingApproval(params, data) {
  return request({
    url: '/web/erp/process/page/todo',
    method: 'post',
    params,
    data,
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}

// 已审批
export function approvedList(params, data) {
  return request({
    url: '/web/erp/process/page/approved',
    method: 'post',
    params,
    data,
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}

// 已完成
export function completedList(params, data) {
  return request({
    url: '/web/erp/process/page/done',
    method: 'post',
    params,
    data,
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}

// 我的发起
export function submittedList(params, data) {
  return request({
    url: '/web/erp/process/page/mySubmit',
    method: 'post',
    params,
    data,
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}

// 审核操作
export function formAuditing(data) {
  return request({
    url: '/web/erp/process/handle',
    method: 'post',
    data,
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}

// 统计
export function countData(data) {
  return request({
    url: '/web/erp/process/count',
    method: 'post',
    data,
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}

// 审批日志
export function approvalLog(data) {
  return request({
    url: '/web/erp/process/logs/' + data,
    method: 'post',
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}

// 取消流程
export function cancelFlow(data) {
  return request({
    url: '/web/erp/process/cancelProcess',
    method: 'post',
    data,
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}

// 单据类型
export function businessTypeData() {
  return request({
    url: '/web/erp/process/businessTypes',
    method: 'get',
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}

// 审批通过
export function approvedSuccess(data) {
  return request({
    url: '/web/erp/process/aggree',
    method: 'post',
    data,
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}

// 审批不通过
export function approvedReject(data) {
  return request({
    url: '/web/erp/process/reject',
    method: 'post',
    data,
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}

// 待审批和已审批查询详情
export function approvalDetail(data) {
  return request({
    url: '/web/erp/process/formByTask',
    method: 'post',
    data,
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}

// 已完成和我的发起查询详情
export function completedDetail(data) {
  return request({
    url: '/web/erp/process/formByProcess',
    method: 'post',
    data,
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}

// 已办任务分类统计
export function classificationCount(data) {
  return request({
    url: '/web/erp/process/countDone',
    method: 'post',
    data,
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}

// 已办任务趋势图
export function trendChartData(data) {
  return request({
    url: '/web/erp/process/countDoneGroupDate',
    method: 'post',
    data,
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}

// 获取流程图xml
export function getFlowXml(id) {
  return request({
    url: '/web/erp/process/nodeStatus/' + id,
    method: 'post',
    hmacReq: true,
    encryptReq: true,
    decryptRes: true,
  });
}
